<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="jt" uri="http://www.jsoft.org/tags/jsoft"%>
<%@ taglib prefix="jh" uri="http://www.jsoft.org/tags/jsoft-html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	if(path!=null&&path.equals("/")){
	   path="";
	} 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>管理员角色设置</title>
		<link href="<%=basePath%>admin/styles/default.css" rel="stylesheet"
			type="text/css" />
		<link href="<%=basePath%>admin/styles/page.css" rel="stylesheet"
			type="text/css" />
	</head>

	<body>
		<div class="title">
			<h2>
				管理员角色设置
			</h2>
		</div>
		<div id="container">
			<!-- table -->
			<div id="info">
				<form action="<%=basePath%>manager/admin/adminRoleSave.do" method="post">
					<table width="100%" cellpadding="3" cellspacing="1" border="0" bgcolor="#e3e3e3">
						<tr bgcolor="#FFFFFF">
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">编号</td>
							<td width="300">
								<c:if test="${requestScope.selectedAdmin ne null}">
								<font color="bule" id="name_txt"><c:out value="${requestScope.selectedAdmin.name}"/></font>
								(<font color="red" id="login_name_txt"><c:out value="${requestScope.selectedAdmin.loginName}"/></font>)
								</c:if>
								<input type="hidden" name="id" id="id" value="${requestScope.selectedAdmin.id}" />
							</td>
							<td nowrap="nowrap">
								<input type="submit" value="保存/修改" class="button" />
								<input type="reset" value="重置" class="button" />
								<input type="hidden" name="page" value="${requestScope.PAGEMODEL.pageNum}"/>
								<font color="red"><c:out value="${requestScope.saveMsg}"/></font>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">角色</td>
							<td colspan="2">
								<c:forEach items="${requestScope.roles}" var="role">
								<c:set var="checked" scope="page" value=""/>
								<c:forEach items="${requestScope.selectedAdmin.roles}" var="selectedRole">
									<c:if test="${selectedRole.id eq role.id}">
										<c:set var="checked" scope="page" value="checked='checked'"/>
									</c:if>
								</c:forEach>
								<input name="check" id="check" type="checkbox" class="checkBox" value="<c:out value="${role.id}"/>" <c:out value="${pageScope.checked}"/> />
								<c:out value="${role.name}"/>
								</c:forEach>
							</td>
						</tr>
					</table>
				</form>
				<div style="height: 10px;"></div>
			</div>
			<table class="table01">
				<tr>
					<th>编号</th>
					<th>用户名</th>
					<th>昵称</th>
					<th>角色</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${requestScope.adminList}" var="admin">
				<tr <c:if test="${requestScope.selectedAdmin.id eq admin.id}">class="selected"</c:if>>
					<td><c:out value="${admin.id}"/></td>
					<td><c:out value="${admin.loginName}"/></td>
					<td><c:out value="${admin.name}"/></td>
					<td>
					<c:forEach items="${admin.roles}" var="role">
						<c:out value="${role.name}"></c:out><br/>
					</c:forEach>
					</td>
					<td>
						<c:if test="${admin.state eq 1}"><font color="blue">有效</font></c:if>
						<c:if test="${admin.state eq 0}"><font color="red">无效</font></c:if>
						(<c:out value="${admin.state}"/>)
					</td>
					<td>
						<a href="<%=basePath%>manager/admin/adminRole.do?id=${admin.id}">修改权限</a>
					</td>
				</tr>
				</c:forEach>
			</table>
			<jt:page/>
		</div>
	</body>
</html>
